﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DbSharp.SupportLib.Crypto;
using System.Diagnostics;

namespace UnitTestProject.Pilot
{
    [TestFixture]
    public class SensitiveMessage
    {
        private void OutputSecretMsg(string msg, string msgHint)
        {
            var crypto = new SymmetricCryptoService();

            string plainText = msg;
            byte[] bytesIn = System.Text.Encoding.ASCII.GetBytes(plainText);
            string base64Text = Convert.ToBase64String(bytesIn);
            string secretText = crypto.Encrypto(base64Text);

            Trace.WriteLine(msgHint);
            Trace.WriteLine(secretText);
            Trace.WriteLine("");
        }

        private void OutputPlainMsg(string msg, string msgHint)
        {
            var crypto = new SymmetricCryptoService();

            string secretText = msg;
            string plainText = crypto.Decrypto(secretText);

            Trace.WriteLine(msgHint);
            Trace.WriteLine(plainText);
            Trace.WriteLine("");
        }

        #region PerfCaseCountOverflowMsgFmt

        public static string PerfCaseCountOverflowMsgFmt
        {
            get { return "-----PerfCase count must not be greater than {0} in this edition."; }
        }


        [Test]
        public void GetPerfCaseCountOverflowMsgFmt()
        {
            OutputSecretMsg(PerfCaseCountOverflowMsgFmt, "PerfCaseCountOverflowMsgFmt");
        }


        #endregion

        #region UnitCaseCountOverflowMsgFmt

        public static string UnitCaseCountOverflowMsgFmt
        {
            get { return "-----UnitCase count must not be greater than {0} in this edition."; }
        }


        [Test]
        public void GetUnitCaseCountOverflowMsgFmt()
        {
            OutputSecretMsg(UnitCaseCountOverflowMsgFmt, "UnitCaseCountOverflowMsgFmt");
        }


        #endregion

        #region CaseXmlLoadMsgFmt

        public static string CaseXmlLoadMsgFmt
        {
            get { return "====={0} of {1} PerfTest cases and {2} of {3} UnitTest cases loaded."; }
        }


        [Test]
        public void GetCaseXmlLoadMsgFmt()
        {
            OutputSecretMsg(CaseXmlLoadMsgFmt, "CaseXmlLoadMsgFmt");
        }


        #endregion

        #region CaseXmlFileErrorMsgFmt

        public static string CaseXmlFileErrorMsgFmt
        {
            get { return "=====Xml file error: {0}"; }
        }


        [Test]
        public void GetCaseXmlFileErrorMsgFmt()
        {
            OutputSecretMsg(CaseXmlFileErrorMsgFmt, "CaseXmlFileErrorMsgFmt");
        }


        #endregion



        #region SoftwareExpiredMsg1

        public static string SoftwareExpiredMsg1
        {
            get { return "Trial period has expired."; }
        }


        [Test]
        public void GetSoftwareExpiredMsg1()
        {
            OutputSecretMsg(SoftwareExpiredMsg1, "SoftwareExpiredMsg1");
        }


        #endregion


        #region SoftwareExpiredMsg2

        public static string SoftwareExpiredMsg2
        {
            get { return "Trial period has expired. Would you like to purchase one non-trial edition?"; }
        }


        [Test]
        public void GetSoftwareExpiredMsg2()
        {
            OutputSecretMsg(SoftwareExpiredMsg2, "SoftwareExpiredMsg2");
        }
                

        #endregion

        #region WarningSoftwareExpiredMsg
        public static string WarningSoftwareExpiredMsg
        {
            get { return "You are using trial edition. It will be expired on {0}."; }
        }


        [Test]
        public void GetWarningSoftwareExpiredMsg()
        {
            OutputSecretMsg(WarningSoftwareExpiredMsg, "WarningSoftwareExpiredMsg");
        }
        #endregion 

        #region UnitTestSetupNotSupportedMsg

        public static string UnitTestSetupNotSupportedMsg
        {
            get { return "Feature setup and teardown for unit testing are not supported in this edition."; }
        }


        [Test]
        public void GetUnitTestSetupNotSupportedMsg()
        {
            OutputSecretMsg(UnitTestSetupNotSupportedMsg, "UnitTestSetupNotSupportedMsg");
        }


        #endregion


        #region InvalidLicenseMsg

        public static string InvalidLicenseMsg
        {
            get { return "License is invalid, please check the license.xml or contact the software vender."; }
        }



        [Test]
        public void GetInvalidLicenseMsg()
        {
            OutputSecretMsg(InvalidLicenseMsg, "InvalidLicenseMsg");
        }

        #endregion


        #region NotAllowRunOnVMMsg

        public static string NotAllowRunOnVMMsg
        {
            get { return "The trial edition does not allow be run on a virtual machine."; }
        }



        [Test]
        public void GetNotAllowRunOnVMMsg()
        {
            OutputSecretMsg(NotAllowRunOnVMMsg, "NotAllowRunOnVMMsg");
        }

        #endregion

        #region MsgboxInfoTitle

        public static string MsgboxInfoTitle
        {
            get { return "Info"; }
        }

        [Test]
        public void GetMsgboxInfoTitle()
        {
            OutputSecretMsg(MsgboxInfoTitle, "MsgboxInfoTitle");
        }

        #endregion


        #region BadConfigFileMsg

        public static string BadConfigFileMsg
        {
            get { return "Application configuration file has beed destroied. Application will exit."; }
        }

        [Test]
        public void GetBadConfigFileMsg()
        {
            OutputSecretMsg(BadConfigFileMsg, "BadConfigFileMsg");
        }

        #endregion


        #region SandboxNotSupportedMsg

        public static string SandboxNotSupportedMsg
        {
            get { return "Feature testInSandbox is not supported in this edition."; }
        }


        [Test]
        public void GetSandboxNotSupportedMsg()
        {
            OutputSecretMsg(SandboxNotSupportedMsg, "SandboxNotSupportedMsg");
        }

        #endregion


        #region DbConnectionCountOverflowMsg

        public static string DbConnectionCountOverflowMsg
        {
            get { return "DbConnection count must not be greater than {0} in this edition."; }
        }


        [Test]
        public void GetDbConnectionCountOverflowMsg()
        {
            OutputSecretMsg(DbConnectionCountOverflowMsg, "DbConnectionCountOverflowMsg");
        }

        #endregion


        #region SetOperationDiffNotSupportedMsg

        public static string SetOperationDiffNotSupportedMsg
        {
            get { return "Set operation diff is not supported in this edition."; }
        }

        [Test]
        public void GetSetOperationDiffNotSupportedMsg()
        {
            OutputSecretMsg(SetOperationDiffNotSupportedMsg, "SetOperationDiffNotSupportedMsg");
        }

        #endregion

 
 

        [Test]
        public void OutputEqualMark()
        {
            char char1 = '=';
            Trace.WriteLine("EqualMark");

            byte[] bytes=System.Text.Encoding.UTF8.GetBytes(new char[] { char1 });

            foreach (var byt in bytes)
            {
                Trace.WriteLine(byt);
            }
            
        }

 
      
    }
}
